from django.http import HttpResponseRedirect
from services.localizationService import *

from django.shortcuts import render_to_response

def home(request):
    return render_to_response('admin.html')

def locals(request):
    a=render_to_response('localizations.html',{'local':getLocalizationsLib()})
    return a

def createLocal(request):
    addLocalization(request.POST['local'])
    return HttpResponseRedirect('/admin/local/')

def local(request, local):
    return render_to_response('localization.html',{'attr':getLocalizationbyName(local),'localization':local})

def createLocalAttr(request, local):
    addAttribute(request.POST['attrName'],request.POST['attrValue'],local)
    return HttpResponseRedirect('/admin/local/'+local)

def delLocalAttr(request,local,attrName):
    deleteAttribute(attrName, local)
    return HttpResponseRedirect('/admin/local/'+local)